package chapter15;

/**
 * Created by lzy
 * Date: 2018/5/14
 */
public class Fill2 {
    //Classtoken version
    public static <T> void fill(Addable<T> addable, Class<? extends T> classToken, int size) {
        for (int i = 0; i < size; i++) {
            try {
                addable.add(classToken.newInstance());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

    //Generator version
    /*public static <T> void fill(Addable<T> addable, ) {

    }*/
}
